<template>
<div class="field myfield">
    <field_title :title_show="!field.hideTitle&&!field.no_title" :field="field" ></field_title>
  <textarea v-model.trim="val" :name="field.name" v-validate="field.valid||{}" :data-vv-as="field.title" :placeholder="placeholder"></textarea>
  <errmsg  v-show="errors.has(field.name)">
    {{ errors.first(field.name) }}
  </errmsg>
</div>
</template>

<script>
import tool from 'src/util/tool';
import util from '_util/index';
import errmsg from 'components/valid/errmsg';
import field_title from 'components/field/com/field_title';
const store=util.store

export default {
  data() {
    return {
      val: ''
    }
  },
  methods: {},
  components:{errmsg,field_title},
  watch: {
    val: function(val, old) {
      //        tool.cl(val, old)
      if (val != old) {
        this.$emit('setVo', this.field.name, val)
      }
    },
    hasError: function(val, old) {
      store.push(this,'setVoError','voErrors', this.field.name, this.errors.first(this.field.name))
    }
  },
  computed: {
    placeholder() {
      return `请输入${this.field.title}`
    },
    hasError(){
      return this.errors.has(this.field.name)
    }
  },
  props: ['field','param'],
  created() {
    this.val=this.field.fval
  },
  mounted() {

  }
};
</script>

<style scoped>
.field {}
</style>
